#include "myfile.h"
#define LOG "log.txt"

int main()
{
    MY_FILE* fp = myfopen(LOG,"a");

    int cnt = 20;
    const char* msg = "Much remains to be done";
    char str[64]={0};
    while(cnt--)
    {
        memset(str,0,64);
        snprintf(str,64,"%s: %d ",msg,cnt);
        if(cnt%5==0)
        {
            str[strlen(str)] = '\n';
        }
        myfwrite(str,strlen(str),1,fp);
        sleep(1);
    }

    myfclose(fp);
    return 0;

    //FILE* fp = fopen(LOG,"w");

    //const char* msg = "Much remains to be done.";
    //
    //fwrite(msg,strlen(msg),1,fp);
    //fclose(fp);

    //return 0;
}
